package service

import "backend/utils/format"

type IServiceError interface {
	GetErrorCode() format.ResCode
	GetParams() []interface{}
}

func NewServiceError(errorCode format.ResCode, params ...interface{}) *serviceError {
	return &serviceError{
		errorCode: errorCode,
		params:    params,
	}
}

type serviceError struct {
	errorCode format.ResCode
	params    []interface{}
}

func (se serviceError) GetErrorCode() format.ResCode {
	return se.errorCode
}

func (se serviceError) GetParams() []interface{} {
	return se.params
}
